# coding:utf-8
import pandas as pd
from sklearn.model_selection  import train_test_split
from sklearn.neural_network import MLPClassifier

data_source = pd.read_csv("iris.csv")
inputs = data_source[['花萼长度', '花萼宽度',
                             '花瓣长度', '花瓣宽度']].values
outputs = data_source['属种'].values
(train_inputs, test_inputs, train_outputs, test_outputs) = train_test_split(inputs, outputs, train_size=0.8, test_size=0.2)

'''
adam,sgd,lbfgs
'''
classifier = MLPClassifier(solver="lbfgs")
classifier.fit(train_inputs, train_outputs)
print(classifier.score(test_inputs, test_outputs))
print(classifier.predict([[0.1, 0.2, 0.3, 0.4]]))

